home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 090 / wheels2.arc / LESSRAM.PAS < prev    next >
Pascal/Delphi Source File  |  1985-06-28  |  3KB  |  71 lines

  1. {@@@@@@@@@@@ copyright (C) 1984 by Neil J. Rubenking @@@@@@@@@@@@@@@@@@@@@@@@
  2. The purchaser of these procedures and functions may include them in COMPILED
  3. programs freely, but may not sell or give away the source text.
  4.  
  5.      This little program is to be used for TESTING other programs.
  6.      Suppose you have 640K (and why not?!), but users of the
  7.      program you're developing may only have 64K.  To be SURE they
  8.      can use it, you could open your PC and set your switches down
  9.      to 64K.  LESSRAM makes this switch-setting unnecessary.  It
  10.      changes what's recorded in the location where your PC stores
  11.      what it thinks your memory is, and then "warm reboots" to make
  12.      the new value active.
  13.          1)  You MUST run this program COMPILED to disk.
  14.          2)  Just type LESSRAM nnn, where nnn is a number LESS than
  15.              your actual RAM.  (If you leave off the parameter, you
  16.              will get a message as to just how much RAM you have, and
  17.              a chance to set the new value.
  18.          3)  LESSRAM should be used immediately after booting up (either
  19.              by turning PC on or by <Ctrl><Alt><Del>).  If another
  20.              program has been active, LESSRAM may hang up your system
  21.          4)  It appears that certain device drivers in the CONFIG.SYS
  22.              file interfere with LESSRAM.  If I run LESSRAM on my system,
  23.              I have to rename CONFIG.SYS to something else first --
  24.              otherwise my A: drive spins indefinitely.
  25.          5)  Strangely enough, using LESSRAM does NOT clear out resident
  26.              programs like SIDEKICK, even though they reside in high
  27.              memory.
  28.  
  29. }
  30.  
  31. {$I reboot.lib}
  32. type
  33.   ParamString = string[3];
  34. var
  35.   Memory_Size : integer absolute $0040:$0013;
  36.   Parameter   : ParamString absolute CSeg:$0081;
  37.   ParamLength : byte absolute CSeg:$0080;
  38.   AsciiNew    : ParamString;
  39.   New_Size    : integer;
  40.  
  41. {@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@}
  42. procedure GetParameters;
  43. var
  44.   code : integer;
  45. begin
  46.   AsciiNew := copy(Parameter,1,ParamLength);
  47.   while pos(' ',AsciiNew) <> 0 do
  48.     delete(AsciiNew,pos(' ',AsciiNew),1);
  49.   val(AsciiNEW,New_Size,code);
  50.   if code <> 0 then
  51.     New_Size := 0;
  52. end;
  53. {@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@}
  54. begin
  55.   GetParameters;
  56.   if New_Size = 0 then
  57.     begin
  58.       WriteLn('Your switches show ',Memory_size,'K.');
  59.       repeat
  60.         WriteLn('Enter size to reset memory to: ');
  61.         read(New_Size);
  62.       until (New_Size >= 64) and (New_Size <= Memory_size);
  63.     end;
  64.   Memory_Size := New_Size;
  65.   WriteLn;
  66.   WriteLn('Memory Size word changed to ',Memory_Size);
  67.   WRiteLn('Press a key to go on to REBOOT the system.');
  68.   repeat until keypressed;
  69.   reboot;
  70. end.
  71.